const { program } = require('commander')
const DocxConverter = require('./converter')
const logger = require('./logger')

program
  .name('word2md')
  .description('DOCX 转 Markdown 工具')
  .requiredOption('-i, --input <dir>', '输入目录')
  .option('-o, --output <dir>', '输出目录', './markdown_output')
  .version('3.0.0')

program.parse()
const options = program.opts()

async function main() {
  const converter = new DocxConverter(options.input, options.output)
  await converter.run()
}

main().catch(err => {
  logger.error(`致命错误: ${err.message}`)
  process.exit(1)
})
//控制台执行命令
// node src/index.js -i ./documents -o ./output
//  node src/index.js -i ./input-file -o ./output-manuals5